package com.woniuxy.intellihome.controller.admin;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.woniuxy.intellihome.entity.Detailimg;
import com.woniuxy.intellihome.entity.ResponseEntity;
import com.woniuxy.intellihome.entity.Sku;
import com.woniuxy.intellihome.service.DetailimgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author jobob
 * @since 2021-08-11
 */
@RestController
@RequestMapping("admin/detailimg")
public class DetailimgController {
    @Autowired
    private DetailimgService imgService;

    @RequestMapping("add")
    public ResponseEntity  add(@RequestBody Detailimg img) {
        imgService.save(img);
        return new ResponseEntity(img);
    }
    @RequestMapping("getimgs")
    public ResponseEntity<List<Detailimg>> getImages(int id) {
        Detailimg img=new Detailimg();
        img.setSkuId(id);
        Wrapper wrapper=new QueryWrapper(img);
        List<Detailimg> list = imgService.list(wrapper);
        return new ResponseEntity<>(list);
    }

}

